//员工管理
import request from "@/api/request.js";

export const getAllEmployeeService = DataObj => {
  let url = `/api-self/admin_panel/institution/${DataObj.institutionId}/department/${DataObj.departmentId}/workers`;
  return request.get(url);
};

export const addEmployeeService = DataObj => {
  let url = `/api-self/admin_panel/institution/${DataObj.institutionId}/department/${DataObj.departmentId}/worker`;
  let Data = {
    rank: Data.rank
  };
  return request.post(url, Data);
};

export const delEmployeeService = DataObj => {
  let url = `/api-self/admin_panel/institution/${DataObj.institutionId}/department/${DataObj.departmentId}/worker/${DataObj.workerId}`;
  return request.delete(url);
};

export const editEmployeeService = DataObj => {
  let url = `/api-self/admin_panel/institution/${DataObj.institutionId}/department/${DataObj.departmentId}/worker/${DataObj.workId}`;
  let Data = {
    rank: DataObj.rank,
    institutionid: DataObj.institutionId,
    departmentid: DataObj.departmentId
  };
  return request.put(url, Data);
};

export const getEmployeeService = DataObj => {
  let url = `/api-self/admin_panel/institution/${DataObj.institutionId}/department/${DataObj.departmentId}/worker/${DataObj.workId}`;
  return request.get(url);
};
